package com.newbingo.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


import com.newbingo.domain.common.EntitySupport;
import com.newbingo.domain.common.Identity;


/** 
 * Game Entity
 * 
 */

@Entity
@Table(name = "game")
public class Game implements java.io.Serializable {
	@Identity
	private Integer gameno;
	private String gamename;
	private String type;
	private String rule;
	private Set<GamePlay> plays;
	private Set<GameTable> gtable;


	@OneToMany(mappedBy = "game", targetEntity = GameTable.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public Set<GameTable> getGtable() {
		return gtable;
	}

	public void setGtable(Set<GameTable> gtable) {
		this.gtable = gtable;
	}


	// 默认构造函数
	public Game() {

	}

	// 设置编号 自动增长
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "gameno")
	public Integer getGameno() {
		return gameno;
	}

	public void setGameno(Integer gameno) {
		this.gameno = gameno;
	}

	public String getGamename() {
		return gamename;
	}

	public void setGamename(String gamename) {
		this.gamename = gamename;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getRule() {
		return rule;
	}

	public void setRule(String rule) {
		this.rule = rule;
	}

	@OneToMany(mappedBy = "game", targetEntity = GamePlay.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public Set<GamePlay> getPlays() {
		return plays;
	}
 
	public void setPlays(Set<GamePlay> plays) {
		this.plays = plays;
	}

}
